The Support Kit Table of Contents | The Support Kit Index |
Declared in: be/support/Errors.h
Error codes are returned by various functions to indicate the success or to describe the failure of a requested operation.
All Be error constants except for B_OK (B_NO_ERROR) are negative integers; any function that returns an error code can thus be lazily tested for success or failure by the following:
if ( funcCall() < B_NO_ERROR ) /* failure */ else /* success */
All constants (except B_NO_ERROR and B_ERROR) are less than or equal to the value of the B_ERRORS_END constant. If you want to define your own negative-valued error codes, you should begin with the value (B_ERRORS_END + 1) and work your way toward 0.
The BeOS supports the POSIX error code constants (these constants start with the letter "E", as in EBADF or ENOENT). A number of Be-defined constants are synonyms for the POSIX constants; for example, the Be equivalent for ENOENT is B_ENTRY_NOT_FOUND.
Most of the General Error Codes, and all the File System Error Codes are covers for POSIX errors. The POSIX equivalents are listed where applicable.
The POSIX constants, and the Be synonyms, can be passed to the POSIX strerror() function. The function, defined in posix/string.h, returns a human-readable description of the error:
char *strerror(int error_code)
Code | Description |
---|---|
B_BAD_THREAD_ID | Specified thread identifier (thread_id) is invalid |
B_BAD_THREAD_STATE | The thread is in the wrong state for the operation |
B_NO_MORE_THREADS | All thread identifiers are currently taken |
B_BAD_TEAM_ID | Specified team identifier (team_id) is invalid |
B_NO_MORE_TEAMS | All team identifiers are currently taken |
B_BAD_PORT_ID | Specified port identifier (port_id) is invalid |
B_NO_MORE_PORTS | All port identifiers have been taken |
B_BAD_SEM_ID | Semaphore identifier (sem_id) is invalid |
B_NO_MORE_SEMS | All semaphores are currently taken |
B_BAD_IMAGE_ID | Specified image identifier (image_id)is invalid |
B_NOT_AN_EXECUTABLE | An executable image was expected |
B_BAD_ADDRESS | Illegal address |
B_MISSING_LIBRARY | A library needed by an application is missing |
B_MISSING_SYMBOL | A symbol needed by an application is missing |
B_DEBUGGER_ALREADY_ INSTALLED | An attempt was made to install the debugger when it was already installed. |
The Support Kit Table of Contents | The Support Kit Index |
Copyright © 2000 Be, Inc. All rights reserved..